# 使用DoG和SIFT进行特征提取和描述

import cv2
import numpy as np
import sys

img = cv2.imread("image/chess_board.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

sift = cv2.xfeatures2d.SIFT_create()
keypoints, descriptor = sift.detectAndCompute(gray, None)

img = cv2.drawKeypoints(
    image=img, keypoints=keypoints, outImage=img,
    color=(255, 0, 0), flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)

cv2.imshow('sift_keypoint', img)
cv2.waitKey()
cv2.destroyAllWindows()

